package com.lovegu.thread;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author 老顾
 * @title: Test2
 * @projectName java-restudy
 * @email: 1437594522@qq.com
 * @date 2022/9/23 15:25
 */
public class Test2 {
    private static AtomicInteger ADDER = new
            AtomicInteger();
    public static void main(String[] args) throws
            InterruptedException {
        for (int i = 0; i < 1000; i++) {
            Thread thread = new Thread(() -> {
                ADDER.getAndIncrement();
            });
            thread.start();
            thread.join();
        }
        System.out.println(ADDER.get());
    }
}
